package com.example.springboot_demo.service.Impl;

import com.example.springboot_demo.dao.BookDao;
import com.example.springboot_demo.pojo.Book;
import com.example.springboot_demo.pojo.CartData;
import com.example.springboot_demo.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CartServiceImpl implements CartService {
    @Autowired
    private BookDao bookDao;


    @Override
    public CartData<Book> cartData_add(int id) {
        Book book = bookDao.getBookById(id);
        CartData<Book> cartData = new CartData(book.getBookId(), book.getBookName(), 1, book.getPrice(), book.getPrice());
        return cartData;
    }

}
